package org.rcy.framework.data.transaction;

/**
 * 事务信息
 */
public class TransactionInfo {
	private String method;
	private long startTime;
	private String tractId;
	private String connectionId;

	public long cost(long currentTime) {
		return currentTime == 0 ? System.currentTimeMillis() : currentTime - startTime;
	}

	public TransactionInfo(String method, long startTime, String tractId, String connectionId) {
		super();
		this.method = method;
		this.startTime = startTime == 0 ? System.currentTimeMillis() : startTime;
		this.tractId = tractId;
		this.connectionId = connectionId;
	}

	public String getMethod() {
		return method;
	}

	public String getTractId() {
		return tractId;
	}

	public String getConnectionId() {
		return connectionId;
	}

}